<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">
<head>
    <title>Openfire: Docker Guide</title>
    <link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
    <div id="pageContainer">
        <a name="top"></a>
        <div id="pageHeader">
            <div id="logo"></div>
            <h1>Docker Guide</h1>
        </div>
        <div class="navigation">
            <a href="index.html">&laquo; Back to documentation index</a>
        </div>
    
        <div id="pageBody">
            <h2>Introduction</h2>
            <p>Openfire can be deployed as part of a container architecture. This document covers how the official images are built, how to deploy them, and how you can build your own.</p>

            <h2>Builds</h2>
            <p>The official builds of Openfire for Docker come from GitHub. When a tag is pushed, a new image is built by the CI and uploaded to Docker Hub with the same tag. Any push to the master branch is built and pushed to the 'latest' tag on Docker Hub, and whilst every effort made, these should be considered potentially unstable.</p>
            <p>You can build the container image locally as you might any other, using <pre>docker build . -t openfire:mytag</pre>. Note that Openfire is a large application in a monorepo with a sizeable number of dependencies, and as such doesn't use a multi-stage build for Docker. Instead it builds an image from an already compiled repository. For more repeatable builds, try <pre>build/docker/buildWithDocker.sh</pre>.</p>

            <h2>Usage</h2>
            <p>You can run a simple container with <pre>docker run --rm -d -p 5222:5222 -p 5269:5269 -p 7070:7070 -p 7443:7443 -p 9090:9090 igniterealtime/openfire:sometag</pre> and configure for the internal database. You can add volumes to achieve persistance between restarts and upgrades.</p>
            <p>For more complex or productionised setups, you could use docker-compose.
                <pre>
openfire:
    image: "igniterealtime/openfire:sometag"
    ports:
      - "5222:5222"
      - "5269:5269"
      - "7070:7070"
      - "7443:7443"
      - "9090:9090"
    depends_on:
      - "postgres_service"
    volumes:
      - ./data/conf:/var/lib/openfire/conf
      - ./wait-for-it.sh:/wait-for-it.sh
    command: ["/wait-for-it.sh", "postgres_service:5432", "--", "/sbin/entrypoint.sh"]
                </pre>
            In this example, we've used <a href="https://github.com/vishnubob/wait-for-it/blob/master/wait-for-it.sh">wait-for-it</a> to allow a postgres database service (not shown) to finish launching prior to starting Openfire. This allows us to have premade files in /data/conf with which to launch Openfire.
            </p>
        </div>  
    </div>
</body>